import CocosHelper from "../../../UIFrame/CocosHelper";
import { FormType, ModalOpacity } from "../../../UIFrame/config/SysDefine";
import { MaskType } from "../../../UIFrame/FrameType";
import UIBase from "../../../UIFrame/UIBase";

const { ccclass, property } = cc._decorator;

@ccclass
export default class SignUI extends UIBase {

    formType = FormType.PopUp;
    maskType = new MaskType(ModalOpacity.OpacityHalf, false);

    static prefabPath = "prefabs/UIForms/SignUI";

    @property(cc.Button)
    btnSign: cc.Button = null;

    @property(cc.Node)
    btnLibel: cc.Node = null;

    @property(cc.Node)
    signdays: cc.Node = null;

    @property([cc.SpriteFrame])
    bgSpriteF: cc.SpriteFrame[] = [];

    private btnMask: boolean = false;
    private startPosition: cc.Vec2;

    async load() {
        cc.log('load');
    }

    onInit() {
        cc.log('onInit');
    }

    async onShow(startPosition: cc.Vec2) {
        cc.log('onShow');
        this.startPosition = this.node.convertToNodeSpaceAR(startPosition);
        this.initSignUI();
    }

    async showAnimation() {
        this.node.scale = 0;
        this.node.setPosition(this.startPosition);

        await CocosHelper.runTweenSync(this.node, cc.tween().to(0.2, { position: cc.v3(0, 0, 0), scale: 1 }, cc.easeBackOut()));
    }

    onLoad() {
        cc.log('onload');
    }

    start() {
        cc.log('start');
    }

    initSignUI() {

    }

    onclickEvent_GetAward(event, type) {
    }

    showMsgTip(tip: string) {
        // TipManage.Instance().create(tip);
    }

    onClickEvent_closeUI() {
        this.closeUIForm();
    }

    onHide() {
        cc.log('onHide');
    }
}
